//
//  PartsTableViewCell.m
//  CarOfHome2
//
//  Created by 微 醺 on 15/9/24.
//  Copyright (c) 2015年 Frank. All rights reserved.
//

#import "PartsTableViewCell.h"

@implementation PartsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.PersonImg = [[UIImageView alloc] init];
//        self.PersonImg.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_PersonImg];
        
        self.title = [[UILabel alloc] init];
//        self.title.backgroundColor= [UIColor cyanColor];
        [self.contentView addSubview:_title];
        
        self.text = [[UILabel alloc] init];
//        self.text.backgroundColor = [UIColor greenColor];
        [self.contentView addSubview:_text];
        
        self.wenzi1 = [[UILabel alloc] init];
//        self.wenzi1.backgroundColor = [UIColor yellowColor];
        self.wenzi1.text = @"参考价格:";
        [self.contentView addSubview:_wenzi1];

        self.price = [[UILabel alloc] init];
//        self.price.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_price];

    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    AppDelegate *dele = [[UIApplication sharedApplication]delegate];
    if (dele.isNight == 1) {
        self.contentView.backgroundColor = [UIColor blackColor];
        self.text.textColor = [UIColor whiteColor];
        self.title.textColor = [UIColor whiteColor];
        self.wenzi1.textColor = [UIColor whiteColor];
        
    }
    else{
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.text.textColor = [UIColor grayColor];
        self.title.textColor = [UIColor blackColor];
        self.wenzi1.textColor = [UIColor blackColor];
    }
    self.PersonImg.frame = CGRectMake(SAWindth * 10, SAHeight * 20, SAWindth * 100, SAHeight * 80);
    self.title.frame = CGRectMake(SAWindth * 120, SAHeight * 15, SAWindth * 250, SAHeight * 30);
    self.title.font = [UIFont boldSystemFontOfSize:18];
    self.text.frame = CGRectMake(SAWindth * 120, SAHeight * 40, SAWindth * 250, SAHeight * 40);
    self.text.numberOfLines = 0;
    self.text.textColor = [UIColor grayColor];
    self.text.font = [UIFont systemFontOfSize:16];
    self.wenzi1.frame = CGRectMake(SAWindth * 120, SAHeight * 80, SAWindth * 80, SAHeight * 20);
    self.price.frame = CGRectMake(SAWindth * 200, SAHeight * 80, SAWindth * 150, SAHeight * 20);
    self.price.textColor = [UIColor redColor];
    self.price.font = [UIFont systemFontOfSize:19];

}

- (void)setItemModel:(ItemModel *)itemModel
{
    _itemModel = itemModel;
    [self.PersonImg sd_setImageWithURL:[NSURL URLWithString:itemModel.cover] placeholderImage:nil];
    self.title.text = itemModel.name;
    self.text.text = itemModel.descriptionT;
    self.price.text = itemModel.price_text;
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
